package week5;

/**
 * Created by dell on 2017/3/25.
 */
//子类覆盖父类方法不能比父类抛出更大异常
class Father3 {
    void test() throws Exception /*ClassNotFoundException*/ {
        // 非运行时异常
        System.out.println("父类");
        throw new Exception() /*ClassNotFoundException()*/;
    }
}

class Son3 extends Father3 {
    void test() throws ClassNotFoundException /*Exception*/ {
        // 非运行时异常
        System.out.println("子类");
        throw new ClassNotFoundException() /*Exception()*/;
    }
}
 public class Demo3 {
    public static void main(String[] args) throws Exception {
        Father f = new Son();
        f.test();
    }
}